[deps]
kernel-headers

[mirrors]
ftp://ftp.alsa-project.org/pub/lib/alsa-lib-1.0.28.tar.bz2
http://gentoo.netnitco.net/distfiles/alsa-lib-1.0.28.tar.bz2
http://alsa.cybermirror.org/lib/alsa-lib-1.0.28.tar.bz2
http://distfiles.lesslinux.org/alsa-lib-1.0.28.tar.bz2
http://distfiles.exherbo.org/distfiles/alsa-lib-1.0.28.tar.bz2

[main]
filesize=903786
sha512=a08430d0beb4a751b1608d148f4fc3d1077a689f5f7197b830a2768d66238b69de2614448d56643fbcb3141faa06ab361b7a8579cce4303304bce8c10de01f08

[build]
printf "all:\n\ttrue\n\ninstall:\n\ttrue\n\n" > test/Makefile.in

patch -p1 < "$K"/alsa-lib_mask_inline.patch
patch -p1 < "$K"/alsa-lib_versioning.patch

sed -i 's,#if !defined(_POSIX_C_SOURCE) && !defined(_POSIX_SOURCE),#if 0,' include/global.h

THIS="$PWD"

debugcflags=
debugflags=
if [ "$DEBUGBUILD" = 1 ] ; then
	debugflags=--with-debug
	debugcflags="-O0 -g3"
fi

[ -n "$CROSS_COMPILE" ] && \
  xconfflags="--host=$($CC -dumpmachine|sed 's/musl/gnu/')"

# by default alsa-lib uses --with-versioned, which will create 2 sets of functions,
# one for the old ABI that was deprecated over 10 years ago, and the current one,
# with versioning symbols. since musl's symlinker previously didn't support
# symbol versioning at all, the effect was that we got the wrong (old) functions
# used instead of the new ones, which caused serious breakage.
# musl now implements the subset of symbol versioning needed to get the default
# symbol version, so this isn't strictly needed anymore - however using the versioned
# stuff still bloats up the library with obsolete ancient junk nobody uses.

CFLAGS="-include stdlib.h -D_POSIX_C_SOURCE=200809L -D_GNU_SOURCE -Os $debugcflags $optcflags" \
LDFLAGS="$optldflags" \
  ./configure -C \
	 --prefix="$butch_prefix" \
         --disable-python \
         --without-versioned \
         $debugflags $xconfflags

find . -name Makefile -exec sed -i 's,STRIP = strip,STRIP = echo,' "{}" \;

make V=1 -j$MAKE_THREADS
make DESTDIR="$butch_install_dir" install
